<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.11.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>cppMISC: include/details/itimer.hpp 源文件</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/javascript" src="../../darkmode_toggle.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">cppMISC<span id="projectnumber">&#160;v1.1</span>
   </div>
   <div id="projectbrief">cppMisc 文档系统</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.11.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('../../',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="../../dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="../../dir_ae5bdaf1b45f3c0e6fd5dd3984d2eafd.html">details</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">itimer.hpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../db/d24/itimer_8hpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#include &lt;atomic&gt;</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="foldopen" id="foldopen00014" data-start="{" data-end="};">
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html">   14</a></span><span class="keyword">struct </span><a class="code hl_struct" href="../../d2/d38/structi_timer.html">iTimer</a></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span>{</div>
<div class="foldopen" id="foldopen00016" data-start="{" data-end="};">
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5ab">   16</a></span>    <span class="keyword">enum</span> <a class="code hl_enumeration" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5ab">emErrCode</a></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span>    {</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5abaa09563b77a12d14f77018d048ce4d6fb">   18</a></span>        <a class="code hl_enumvalue" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5abaa09563b77a12d14f77018d048ce4d6fb">ERR_CREATE_TIMER</a> = -1000,      <span class="comment">// 创建计时器错误</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba411cbed936ceec95393a481fd39d6cef">   19</a></span>        <a class="code hl_enumvalue" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba411cbed936ceec95393a481fd39d6cef">ERR_MISSING_INFO_FUN</a>,          <span class="comment">// 缺少了事件通知函数</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba69bdc858844fbe024b1459b4d869e2a7">   20</a></span>        <a class="code hl_enumvalue" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba69bdc858844fbe024b1459b4d869e2a7">ERR_START_TIMER</a>,               <span class="comment">// 启动计时器错误</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba9d8d590f2b964254d8190d547b882fde">   21</a></span>        <a class="code hl_enumvalue" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba9d8d590f2b964254d8190d547b882fde">ERR_STOP_TIMER</a>,                <span class="comment">// 停止计时器错误</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba4033ecbc2c2e7418fd4f2d5e62159d6c">   22</a></span>        <a class="code hl_enumvalue" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba4033ecbc2c2e7418fd4f2d5e62159d6c">ERR_TICK</a>,                      <span class="comment">// 计时时间配置错误</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span>        <a class="code hl_enumvalue" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba74f5e1cb5939af592e4e7c06a3406e9e">OK</a> = 0 </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba74f5e1cb5939af592e4e7c06a3406e9e">   24</a></span>    };</div>
</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a0bd87be9906e599b0776fc592cf81f9c">   30</a></span>    <span class="keyword">virtual</span> <a class="code hl_enumeration" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5ab">emErrCode</a> <a class="code hl_function" href="../../d2/d38/structi_timer.html#a0bd87be9906e599b0776fc592cf81f9c">Start</a>( <span class="keywordtype">long</span> ms = -1, <span class="keywordtype">bool</span> oneShot = <span class="keyword">false</span>) = 0;</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#aa51cbfaef39ee9841c24ff65ce720acc">   35</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d38/structi_timer.html#aa51cbfaef39ee9841c24ff65ce720acc">SetOwner</a>( std::function&lt;<span class="keywordtype">void</span>(  )&gt; fun ) = 0;</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a38cfdd65a88c39d24e2ddc3ceeebda2e">   39</a></span>    <span class="keyword">virtual</span> <a class="code hl_enumeration" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5ab">emErrCode</a> <a class="code hl_function" href="../../d2/d38/structi_timer.html#a38cfdd65a88c39d24e2ddc3ceeebda2e">Stop</a>(  ) = 0;</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#abea86b75a4bcc2399821b799e221b9ce">   43</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code hl_function" href="../../d2/d38/structi_timer.html#abea86b75a4bcc2399821b799e221b9ce">IsRuning</a>(  ) = 0;</div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#ad51fd07ebb8585928243674cb21e80e0">   47</a></span>    <span class="keyword">virtual</span> <a class="code hl_enumeration" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5ab">emErrCode</a> <a class="code hl_function" href="../../d2/d38/structi_timer.html#ad51fd07ebb8585928243674cb21e80e0">Reset</a>() = 0;</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span> </div>
<div class="line"><a id="l00049" name="l00049"></a><span class="lineno"><a class="line" href="../../d2/d38/structi_timer.html#a3aaa71906aca3939acf219852b2d36d9">   49</a></span>    <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d2/d38/structi_timer.html#a3aaa71906aca3939acf219852b2d36d9">setTick</a>( <span class="keywordtype">long</span> t ) = 0;</div>
<div class="line"><a id="l00050" name="l00050"></a><span class="lineno">   50</span>    </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span>    <span class="keyword">static</span> std::string <a class="code hl_function" href="../../d2/d38/structi_timer.html#ae0b9a3f6caa6ae2a56bd06898da25ce1">errMsg</a>( <a class="code hl_enumeration" href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5ab">emErrCode</a> e );</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span>};</div>
</div>
<div class="ttc" id="astructi_timer_html"><div class="ttname"><a href="../../d2/d38/structi_timer.html">iTimer</a></div><div class="ttdoc">定时器定义接口</div><div class="ttdef"><b>定义</b> <a href="#l00014">itimer.hpp:15</a></div></div>
<div class="ttc" id="astructi_timer_html_a0bd87be9906e599b0776fc592cf81f9c"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a0bd87be9906e599b0776fc592cf81f9c">iTimer::Start</a></div><div class="ttdeci">virtual emErrCode Start(long ms=-1, bool oneShot=false)=0</div><div class="ttdoc">启动或者重启计时器。</div></div>
<div class="ttc" id="astructi_timer_html_a31bdd3250ca6c5542d0ec156bd82c5ab"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5ab">iTimer::emErrCode</a></div><div class="ttdeci">emErrCode</div><div class="ttdef"><b>定义</b> <a href="#l00016">itimer.hpp:17</a></div></div>
<div class="ttc" id="astructi_timer_html_a31bdd3250ca6c5542d0ec156bd82c5aba4033ecbc2c2e7418fd4f2d5e62159d6c"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba4033ecbc2c2e7418fd4f2d5e62159d6c">iTimer::ERR_TICK</a></div><div class="ttdeci">@ ERR_TICK</div><div class="ttdef"><b>定义</b> <a href="#l00022">itimer.hpp:22</a></div></div>
<div class="ttc" id="astructi_timer_html_a31bdd3250ca6c5542d0ec156bd82c5aba411cbed936ceec95393a481fd39d6cef"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba411cbed936ceec95393a481fd39d6cef">iTimer::ERR_MISSING_INFO_FUN</a></div><div class="ttdeci">@ ERR_MISSING_INFO_FUN</div><div class="ttdef"><b>定义</b> <a href="#l00019">itimer.hpp:19</a></div></div>
<div class="ttc" id="astructi_timer_html_a31bdd3250ca6c5542d0ec156bd82c5aba69bdc858844fbe024b1459b4d869e2a7"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba69bdc858844fbe024b1459b4d869e2a7">iTimer::ERR_START_TIMER</a></div><div class="ttdeci">@ ERR_START_TIMER</div><div class="ttdef"><b>定义</b> <a href="#l00020">itimer.hpp:20</a></div></div>
<div class="ttc" id="astructi_timer_html_a31bdd3250ca6c5542d0ec156bd82c5aba74f5e1cb5939af592e4e7c06a3406e9e"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba74f5e1cb5939af592e4e7c06a3406e9e">iTimer::OK</a></div><div class="ttdeci">@ OK</div><div class="ttdef"><b>定义</b> <a href="#l00024">itimer.hpp:23</a></div></div>
<div class="ttc" id="astructi_timer_html_a31bdd3250ca6c5542d0ec156bd82c5aba9d8d590f2b964254d8190d547b882fde"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5aba9d8d590f2b964254d8190d547b882fde">iTimer::ERR_STOP_TIMER</a></div><div class="ttdeci">@ ERR_STOP_TIMER</div><div class="ttdef"><b>定义</b> <a href="#l00021">itimer.hpp:21</a></div></div>
<div class="ttc" id="astructi_timer_html_a31bdd3250ca6c5542d0ec156bd82c5abaa09563b77a12d14f77018d048ce4d6fb"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a31bdd3250ca6c5542d0ec156bd82c5abaa09563b77a12d14f77018d048ce4d6fb">iTimer::ERR_CREATE_TIMER</a></div><div class="ttdeci">@ ERR_CREATE_TIMER</div><div class="ttdef"><b>定义</b> <a href="#l00018">itimer.hpp:18</a></div></div>
<div class="ttc" id="astructi_timer_html_a38cfdd65a88c39d24e2ddc3ceeebda2e"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a38cfdd65a88c39d24e2ddc3ceeebda2e">iTimer::Stop</a></div><div class="ttdeci">virtual emErrCode Stop()=0</div><div class="ttdoc">停止计时器</div></div>
<div class="ttc" id="astructi_timer_html_a3aaa71906aca3939acf219852b2d36d9"><div class="ttname"><a href="../../d2/d38/structi_timer.html#a3aaa71906aca3939acf219852b2d36d9">iTimer::setTick</a></div><div class="ttdeci">virtual void setTick(long t)=0</div></div>
<div class="ttc" id="astructi_timer_html_aa51cbfaef39ee9841c24ff65ce720acc"><div class="ttname"><a href="../../d2/d38/structi_timer.html#aa51cbfaef39ee9841c24ff65ce720acc">iTimer::SetOwner</a></div><div class="ttdeci">virtual void SetOwner(std::function&lt; void()&gt; fun)=0</div><div class="ttdoc">指定事件响应函数，</div></div>
<div class="ttc" id="astructi_timer_html_abea86b75a4bcc2399821b799e221b9ce"><div class="ttname"><a href="../../d2/d38/structi_timer.html#abea86b75a4bcc2399821b799e221b9ce">iTimer::IsRuning</a></div><div class="ttdeci">virtual bool IsRuning()=0</div><div class="ttdoc">判断计时器是否正在运行</div></div>
<div class="ttc" id="astructi_timer_html_ad51fd07ebb8585928243674cb21e80e0"><div class="ttname"><a href="../../d2/d38/structi_timer.html#ad51fd07ebb8585928243674cb21e80e0">iTimer::Reset</a></div><div class="ttdeci">virtual emErrCode Reset()=0</div><div class="ttdoc">复位计时，让计时器从零开始计时</div></div>
<div class="ttc" id="astructi_timer_html_ae0b9a3f6caa6ae2a56bd06898da25ce1"><div class="ttname"><a href="../../d2/d38/structi_timer.html#ae0b9a3f6caa6ae2a56bd06898da25ce1">iTimer::errMsg</a></div><div class="ttdeci">static std::string errMsg(emErrCode e)</div><div class="ttdef"><b>定义</b> <a href="../../dc/d46/itimer_8cpp_source.html#l00002">itimer.cpp:2</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.11.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
